import React, {Component} from 'react';
import {StyleSheet, Text, View, Image, ScrollView, ImageBackground} from 'react-native';
import {Button, WhiteSpace, WingBlank, Flex, Toast} from '@ant-design/react-native';
import {saveParkOrder} from '~/store/parkorder';
import {connect} from 'react-redux';
import {saveSystem} from '~/store/system';

const mapGetter = (state) => {
    return {
        userinfo: state.userinfo,
        system: state.system,
        parkorder: state.parkorder,
    };
};

const mapSetter = (dispatch) => {
    return {
        onSave: (data) => {
            dispatch(saveParkOrder(data));
        },
    };
};
class Getmoney extends Component {
    static navigationOptions = {
        title: '返现金',
    };
    constructor(props) {
        //调用基类的所有的初始化方法
        super(props);
        // 设置当前组件的属性
        this.state = {
            parkingid: this.props.parkingid,
            parkingplanitem: this.props.parkorder.parkingplanitem,
        };
    }
    render() {
        return (
            <View style={{width: '100%'}} justify={'center'}>
                <View style={{width: '92%', marginRight: '4%', marginLeft: '4%', marginTop: 10}}>
                    <Flex
                        onPress={() => {
                            this.props.navigation.push('ParkGetMoney', {coinvalue: this.state.parkingplanitem.CoinValue});
                        }}
                        justify={'center'}
                        direction={'column'}
                        style={{backgroundColor: 'white', width: '100%', borderRadius: 5}}>
                        <ImageBackground style={{width: '100%', aspectRatio: 1 / 0.31}} source={require('~/assets/public/moneytu.png')}>
                            <Flex justify={'between'} style={{width: '100%', height: '100%', paddingLeft: 30, paddingRight: 30}}>
                                <Flex align={'end'}>
                                    <Text style={{fontSize: 12, color: '#ec4f46'}}>￥</Text>
                                    <Text style={{fontSize: 26, color: '#ec4f46', fontWeight: 'bold'}}>{this.state.parkingplanitem.CoinValue}</Text>
                                </Flex>
                                <Text style={{fontWeight: 'bold'}}>银仿超市专用现金券</Text>
                            </Flex>
                        </ImageBackground>
                        <Flex style={{width: '100%', paddingLeft: 15, paddingRight: 15, paddingBottom: 10}}>
                            <Text style={{fontsize: 10, color: 'gray'}}>
                                备注：参与活动获得的现金券将会充值到您的<Text style={{color: '#ec4f46', fontsize: 10}}>【银仿超市】</Text>
                                账户，到账后即可正常使用，该券只能用于抵扣现金消费，不能提现
                            </Text>
                        </Flex>
                    </Flex>
                </View>
            </View>
        );
    }
}

const styles = StyleSheet.create({});
export default connect(mapGetter, mapSetter)(Getmoney);
